home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shw_newriver_thaw.cog < prev    next >
Text File  |  1999-11-15  |  15KB  |  494 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shw_river_thaw.cog
  4. #
  5. # River Thawing Script
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.         
  14. #.........................MESSAGES..........................
  15.     message        startup        
  16.     message        activated    
  17.     message        timer    
  18.     message        pulse    
  19.     message     user0    
  20.     
  21. #.........................COGS..........................
  22.     cog         sluice0    
  23.     cog         river0    
  24.     cog         camcog    
  25.     cog         troopcog    
  26.     cog         hintcog    
  27.     cog         fallcog    
  28.     
  29. #.........................CAMERAS..........................
  30.     thing        camerapos
  31.     thing        lightercam
  32.     
  33. #.........................CAM TARGETS..........................
  34.     thing        strt1MoveTarg                    local    
  35.     
  36. #.........................PROPS..........................
  37.     thing          icedam 
  38.     thing        activateplate
  39.     thing          blastpos 
  40.     thing          damPIECE0                            # thaw_damBACK 
  41.     thing          damPIECE1 
  42.     thing          damPIECE2 
  43.     thing          damPIECE3
  44.     thing          explodepos0 
  45.     thing          explodepos1 
  46.     thing          explodepos2
  47.     thing           dustthing                            local
  48.     
  49. #.........................ACTORS..........................
  50.     thing       player                              local
  51.     thing       indyActor
  52.     
  53. #.........................ACTOR MARKS..........................
  54.     thing       playerendpos 
  55.     thing        lighttarget
  56.     thing        runtarget
  57.  
  58.     thing        in_mk0
  59.     
  60. #.........................EVENT LOCATIONS..........................
  61.     thing           projpos0
  62.     thing           projpos1
  63.     thing           projpos2
  64.  
  65.     thing       blastsys                            local 
  66.     thing       flask                               local
  67.     thing       explosion1                           local 
  68.     thing       explosion2                           local 
  69.     thing       explosion3                           local 
  70.  
  71.                 
  72. #.........................VARIABLES..........................
  73.     int         thaw=0                                local
  74.     int         numSectors=13                        local
  75.     int         numSurfaces=35                        local
  76.     int         curCam                                 local
  77.     int         blasted=0                              local             
  78.     int         jarspot=0                              local             
  79.     int         blastvar1                              local             
  80.     int         blastvar2                              local             
  81.     int         blastvar3                            local
  82.     int            swapref                                local
  83.     int            jardebref                            local
  84.     int            misty=0                                local
  85.     int            index=0                                local
  86.     int            i=0                                    local
  87.     
  88.  
  89. #.........................H2O SECTORS..........................
  90.     sector        sect_0
  91.     sector        sect_1
  92.     sector        sect_2
  93.     sector        sect_3
  94.     sector        sect_4
  95.     sector        sect_5
  96.     sector        sect_6
  97.     sector        sect_7
  98.     sector        sect_8
  99.     sector        sect_9
  100.     sector        sect_10
  101.     sector        sect_11
  102.     sector        sect_12
  103.     sector        sect_13
  104.     
  105. #.........................H2O SURFACES..........................
  106.     surface     surf_0
  107.     surface     surf_1
  108.     surface     surf_2
  109.     surface     surf_3
  110.     surface     surf_4
  111.     surface     surf_5
  112.     surface     surf_6
  113.     surface     surf_7
  114.     surface     surf_8
  115.     surface     surf_9
  116.     surface     surf_10
  117.     surface     surf_11
  118.     surface     surf_12
  119.     surface     surf_13
  120.     surface     surf_14
  121.     surface     surf_15
  122.     surface     surf_16
  123.     surface     surf_17
  124.     surface     surf_18
  125.     surface     surf_19
  126.     surface     surf_20
  127.     surface     surf_21
  128.     surface     surf_22
  129.     surface     surf_23
  130.     surface     surf_24
  131.     surface     surf_25
  132.     surface     surf_26
  133.     surface     surf_27
  134.     surface     surf_28
  135.     surface     surf_29
  136.     surface     surf_30
  137.     surface     surf_31
  138.     surface     surf_32
  139.     surface     surf_33
  140.     surface     surf_34
  141.     surface     surf_35
  142.     
  143. #.........................TEMPLATES..........................
  144.     template    blamo=TitanicH2Ofx                        local
  145.     template    exp=+megaflame                               local
  146.     template    projectile=+dummy_debris                 local
  147.     template    jardebris=stnshrapas_nc_ns                 local
  148.     template    dust=dustcloud4ever                        local
  149.     template    ghostTpl=ghost                            local
  150.     
  151. #.........................KEYFRAMES..........................
  152.     keyframe    in_startfire=in_activate_low.key        local
  153.     keyframe    in_pull=0in_key_pull_1_hold.key            local
  154.     keyframe    in_smash=0in_smashjar1_1.key            local
  155.     
  156. #.........................MATERIALS..........................
  157.     material    dustmat=gen_a4sfx_dustcloud.mat            local
  158.     material    oilmat=dam_4ice_frnt.mat                local
  159.     
  160. #.........................MODELS..........................
  161.     model        jarhand=hand_in_oiljar.3do                local
  162.     
  163. #.........................SOUNDS..........................
  164.     sound       fwoosh=olv_waterfall_blast_c.wav          local       # BAM! when the dam gives way
  165.     sound       breakjar=shs_glassbreak.wav                local         # BAM! when the jar breaks
  166.     sound        shatterdam=lag_torp_explo_c.wav            local
  167.     sound        melt_cue=mus_shw_meltice.wav            local        # music for the ice melt
  168.     
  169. #.........................VECTORS..........................
  170.     vector        sect_light                                local    
  171.     vector        camPos                                    local
  172.     vector        duststart                                local
  173.     vector        dustend                                    local
  174.     
  175. end
  176.  
  177. # ========================================================================================
  178.  
  179. code
  180.  
  181. startup:
  182.         
  183. # Smoke cloud sprite vectors
  184.         duststart    = VectorSet(0.2, 0.2, 0.75);
  185.         dustend    = VectorSet(1.2, 1.2, 0.0);
  186.         
  187. # prep player and actor
  188.         AISetCutSceneMode(indyActor);
  189.         player = GetLocalPlayerThing();
  190.     
  191.     
  192. # Clear Water Sectors and Surfs
  193.     sect_light = VectorSet(0.0, 0.5, 1.0);
  194.     
  195.     for (index = 0; index <= numSectors; index = index + 1)
  196.     {
  197.         ClearSectorFlags(sect_0[index], 0x2);
  198.         ClearSectorSurfFlags(sect_0[index], 0x20000);
  199.     }
  200.         
  201.     for (index = 0; index <= numSurfaces; index = index + 1)
  202.     {
  203.         Setfacegeomode(surf_0[index], 0);
  204.     }
  205.  
  206. # hide dam sub-sections
  207.     SetThingFlags(damPIECE0, 0x80000);
  208.     SetThingFlags(damPIECE1, 0x80000);
  209.     SetThingFlags(damPIECE2, 0x80000);
  210.     SetThingFlags(damPIECE3, 0x80000);
  211.  
  212. return;
  213. # ........................................................................................
  214.  
  215. activated:
  216.     
  217.  
  218.     if (thaw == 1) return;    #if the river is already thawed
  219.     if ((GetSenderRef() == activateplate) && (GetCurItem(player) == 79))   #if player is on the dam, has the flask as curInv
  220.         {
  221.         StartCutScene(1);
  222.         SetActorFlags(player, 0x200000);
  223.         DeselectWeaponWait(player);
  224.         Sleep(0.25);
  225.  
  226.         # replace the player with actor indy
  227.         CopyPlayerHolsters(player, indyActor);
  228.         CopyOrientAndPos(player, indyActor);
  229.         ClearThingFlags(indyActor, 0x80000);
  230.         SetThingFlags(player, 0x80000);
  231.         
  232.         #take control of the camera, swing out with an offset
  233.         SetExtCamOffsetToThing(lightercam);
  234.         # create target for secondary focus at indyActor position.
  235.         strt1MoveTarg = CreateThingAtPos(ghostTpl, GetThingSector(indyActor), GetThingPos(indyActor), '0 0 0');
  236.         # offset camera to thing.
  237.         SetExtCamLookOffsetToThing(strt1MoveTarg);
  238.         Sleep(0.5);
  239.         
  240.         # get to camera 2
  241.         RestoreExtCam();
  242.         SetCameraFocus(2, lightercam);
  243.         SetCameraSecondaryFocus(2, strt1MoveTarg);
  244.         Sendmessage(camcog, user0);        #camera becomes 2
  245.         
  246.         # move camera focus object up to strut
  247.         MoveThingToPos(strt1MoveTarg, GetThingPos(lighttarget), 1.0);
  248.         
  249.         # move the actor indy to the ignition position
  250.         AISetLookThingEyeLevel(indyActor, lighttarget);
  251.         AISetMoveSpeed(indyActor, 1.0);
  252.         AISetMoveThing(indyActor, in_mk0, 1);
  253.         Sleep(0.5);
  254.         
  255.         # play the animation of indy smashing the jar
  256.         PlayKey(indyActor, in_smash, 4, 0x12, 0);
  257.         Sleep(.5);
  258.         # swap the jarhand for indy's right hand
  259.         swapref=SetThingMesh(indyActor, 15, jarhand, 0);
  260.         Sleep(1.25);
  261.         
  262.         # swap the empty hand back in
  263.         RestoreThingMesh(indyActor, swapref);
  264.  
  265.         # create the oil puddle
  266.         SetMaterialCel(oilmat, 0);
  267.         materialanim(oilmat, 10, 0);
  268.         
  269.         # create debris from the jar
  270.         for(i=0; i<6; i=i+1)
  271.         {
  272.             jardebref = CreateThing(jardebris, lighttarget);                                 
  273.             SetThingVel(jardebref, VectorScale(VectorAdd(RandVec(), '-0.5 -0.1 0.0'), 1));
  274.             SetThingRotVel(jardebref, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 200.0));
  275.         }
  276.         
  277.         PlaySoundLocal(breakjar, 1.0, 0.0, 0x0, 0);
  278.         Sleep(.25);
  279.         ChangeInv(player, 79, -1);
  280.         
  281.         
  282.         # swap the player for the indyActor
  283.         CopyOrientAndPos(indyActor, player);
  284.         ClearThingFlags(player, 0x80000);
  285.         SetThingFlags(indyActor, 0x80000);
  286.         SelectWeapon(player, 13);
  287.         Sleep(1.75);
  288.         PlayKey(player, in_startfire, 4, 0x12, 1);
  289.         PlaySoundLocal(fwoosh, 1.0, 0.0, 0x0, 0);
  290.         blastvar1=CreateThing(exp, explodepos0);
  291.         blastvar2=CreateThing(exp, explodepos1);
  292.         blastvar3=CreateThing(exp, explodepos2);
  293.         
  294.         # replace player with actorIndy
  295.         DeselectWeapon(player);
  296.         Sleep(1.0);
  297.         
  298.         CopyOrientAndPos(player, indyActor);
  299.         ClearThingFlags(indyActor, 0x80000);
  300.         SetThingFlags(player, 0x80000);
  301.         
  302.         
  303.         # move actorIndy away from blast area
  304.         AISetMoveSpeed(indyActor, 2.5);
  305.         AISetLookThing(indyActor, runtarget);
  306.         Sleep(0.25);
  307.         AISetMoveThing(indyActor, runtarget, 0);
  308.         Sleep(0.75);
  309.         
  310.         # begin screenshake
  311.         Setpulse(0.1);
  312.         misty = 0;
  313.  
  314.         # John Woo camera-fu
  315.         RestoreExtCam();
  316.         SetCameraFocus(2, camerapos);
  317.         SetCamerasecondaryFocus(2, lighttarget);
  318.         MovetoFrame(camerapos, 1, 6);
  319.  
  320.         thaw = 1;
  321.  
  322.         #commies will be waiting in the power room
  323.         #Sendmessage(troopcog, user0);
  324.         
  325.         Sleep(.5);
  326.         SetCameraFOV(70, 1, 3.5);
  327.         Sleep(.5);
  328.         TeleportThing(player, playerendpos);
  329.         
  330.  
  331.         # explosion events timing
  332.         SetTimerEx(2.0, 1, 0, 0);
  333.         SetTimerEx(2.5, 2, 0, 0);
  334.         SetTimerEx(3.5, 3, 0, 0);
  335.         SetTimerEx(4.5, 4, 0, 0);
  336.         
  337.     }
  338.         
  339. return;        
  340.  
  341. # ........................................................................................
  342. timer:
  343.  
  344.         If (GetSenderId() == 1)  # Large ice debris gets created, moved, and faded in here,        
  345.                 {
  346.                         
  347.                         # Set pulse for screenshake
  348.                         #SetPulse(0.05);
  349.                         misty=1;
  350.                         # create a bazooka round, and fire it at the dam for explosion fx
  351.                         CreateThing(projectile, projpos0);
  352.                         CreateThing(projectile, projpos1);
  353.                         CreateThing(projectile, projpos2);
  354.                         destroything(icedam);
  355.                         PlaySoundLocal(shatterdam, 1.0, 0.0, 0x0, 0);
  356.                         SetThingFlags(indyActor, 0x80000);
  357.  
  358.                         
  359.                         # destroy the explosion sprites
  360.                         DestroyThing(blastvar1);
  361.                         DestroyThing(blastvar2);
  362.                         DestroyThing(blastvar3);
  363.                         
  364.                         # Create dust cloud and animate it
  365.                         SetMaterialCel(dustmat, 0);
  366.                         MaterialAnim(dustmat, 12.0, 1);
  367.                         dustthing = CreateThing(dust, projpos1);
  368.                         AnimateSpriteSize(dustthing, duststart, dustend, 4.0);
  369.                         
  370.                         
  371.                         # Create and capture the large ice debris
  372.                         ClearThingFlags(damPIECE0, 0x80000);
  373.                         ClearThingFlags(damPIECE1, 0x80000);
  374.                         ClearThingFlags(damPIECE2, 0x80000);
  375.                         ClearThingFlags(damPIECE3, 0x80000);
  376.                         
  377.                         # move all large debris
  378.                         movetoframe(damPIECE0, 1, 1.0);
  379.                         movetoframe(damPIECE1, 1, 1.0);
  380.                         movetoframe(damPIECE2, 1, 1.0);
  381.                         movetoframe(damPIECE3, 1, 1.0);
  382.                         
  383.                         # fade the ice 3dos
  384.                         ThingFadeAnim(damPIECE0, 1, 0, 2.0, 0);
  385.                         ThingFadeAnim(damPIECE1, 1, 0, 2.0, 0);
  386.                         ThingFadeAnim(damPIECE2, 1, 0, 2.0, 0);
  387.                         ThingFadeAnim(damPIECE3, 1, 0, 2.0, 0);
  388.  
  389.                         #Sendmessage(sluice0,user1);
  390.                         Sleep(0.5);
  391.                         
  392.                         #     play the music cue for the ice melting
  393.                         PlaySoundLocal(melt_cue, 1.0, 0.0, 0x0, 0);
  394.                         
  395.                         misty = 2;
  396.                 }
  397.  
  398.         
  399.         If (GetSenderId() == 2)        #water sectors get set, Div room 1 gets thawed message, and    river sectors get thrust
  400.                 {
  401.                 # water light the sectors
  402.                         for (index = 0; index <= numSectors; index = index + 1)
  403.                         {
  404.                         Setsectorlight(sect_0[index], sect_light, 7);
  405.                         }
  406.                 # Set sectors to water
  407.                     
  408.                         for (index = 0; index <= numSectors; index = index + 1)
  409.                         {
  410.                         SetSectorFlags(sect_0[index], 0x2);
  411.                         SetSectorSurfFlags(sect_0[index], 0x20000);
  412.                         }
  413.                         Sleep(0.5);
  414.                    
  415.                 # Set water faces to water
  416.                         for (index = 0; index <= numSurfaces; index = index + 1)
  417.                         {
  418.                         Setfacegeomode(surf_0[index], 4);
  419.                         }
  420.                 
  421.                 # light the water faces
  422.                         for (index = 0; index <= numSurfaces - 2; index = index + 1)
  423.                         {
  424.                         Setfacelightmode(surf_0[index], 0);
  425.                         }
  426.                         
  427.                 # AllDIVROOMS cog gets it's thawed message
  428.                         #Sendmessage(sluice0,user0);
  429.                         Sleep(0.25);
  430.                         
  431.                 # Riverthrust cog gets it's thawed message
  432.                         #Sendmessage(river0,user0);
  433.                         #Sendmessage(fallcog,user0);
  434.  
  435.                 }        
  436.  
  437.  
  438.  
  439.         If (GetSenderId() == 3)         #screenshake settles
  440.                 {
  441.                     misty = 0;
  442.                     SetPulse(0);
  443.  
  444.                         
  445.                 }
  446.         
  447.         If (GetSenderId() == 4)         # end screenshake, restore camera angle, restore cam 1
  448.                 {
  449.                     #SendMessage(hintcog, user0);
  450.                     #SetCameraFOV(90, 0, 0);
  451.                     SendMessage(camcog, user1);
  452.                     RestoreExtCam();
  453.                     ClearActorFlags(player, 0x200000);
  454.                     EndCutScene();
  455.  
  456.                     # destroy dam sub-sections
  457.                     DestroyThing(damPIECE0);
  458.                     DestroyThing(damPIECE1);
  459.                     DestroyThing(damPIECE2);
  460.                     DestroyThing(damPIECE3);
  461.                     
  462.                 }
  463. return;
  464.  
  465. # ........................................................................................
  466.  
  467. pulse:
  468.         
  469.     If (misty == 0)
  470.         {
  471.             SetPOVShake('0.0 0.0 0.02', '0.0 0.0 0.02', 0.80, 80.0);
  472.         }
  473.  
  474.  
  475.     If (misty == 1)
  476.         {
  477.             blastsys = CreateThing(blamo, blastpos);
  478.             SetPOVShake('0.0 0.0 0.02', '0.0 0.0 0.02', 0.80, 80.0);
  479.         }
  480.  
  481.     If (misty == 2)
  482.         {
  483.             blastsys = CreateThing(blamo, blastpos);
  484.             SetPOVShake('0.0 0.0 0.00', '0.0 0.0 0.04', 0.80, 80.0);
  485.         }
  486.         return;
  487. # ........................................................................................
  488. # ........................................................................................
  489. # ........................................................................................
  490. # ........................................................................................
  491.  
  492. end
  493.  
  494.